package com.lagou.client;

import com.lagou.service.RpcRequest;
import com.lagou.service.UserService;

import java.util.concurrent.atomic.AtomicInteger;

public class ClientBootStrap {

    public static void main(String[] args) throws InterruptedException {
    
        AtomicInteger atomicInteger = new AtomicInteger(0);

        RpcConsumer rpcConsumer = new RpcConsumer();
        
        
        

        while (true){
            Thread.sleep(2000);
    
            atomicInteger.getAndIncrement();
            RpcRequest rpcRequest = new RpcRequest();
            rpcRequest.setClassName("userService");
            rpcRequest.setMethodName("sayHello");
            Object[] paramArr = new Object[1];
            Class<?>[] paramTypeArr = new Class<?>[1];
            paramArr[0] = "are you ok?";
            paramTypeArr[0] = String.class;
            rpcRequest.setParameters(paramArr);
            rpcRequest.setParameterTypes(paramTypeArr);
            rpcRequest.setRequestId(atomicInteger.toString());
    
            UserService proxy = (UserService) rpcConsumer.createProxy(UserService.class, rpcRequest);
            proxy.sayHello(rpcRequest);
        }


    }




}
